package com.sh.data.engine.application.model.request.datadev;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

@Data
@Schema
public class OfflineDevTaskSaveRequest {

    @Schema(description = "任务节点id")
    private Long id;

    @Schema(description = "父节点id", requiredMode = Schema.RequiredMode.REQUIRED)
    private Long pid;

    @NotNull(message = "类型不能为空")
    @Schema(
        description =
            "任务类型 13-sql 14-mr 15-impala 16-shell 17-python2 18-python3 19-pyspark 20-离线同步 21-接口采集 22-数据质量",
        requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer nodeType;

    @Schema(description = "0:http 1:ws", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer apiType;

    @NotBlank(message = "任务名称不能为空")
    @Length(min = 2, max = 64, message = "名称长度为2-64个字符")
    @Pattern(regexp = "[a-zA-Z0-9_\\u4e00-\\u9fa5]+", message = "名称支持中文、字母、数字、下划线")
    @Schema(description = "任务名称", requiredMode = Schema.RequiredMode.REQUIRED)
    private String nodeName;

    @Schema(description = "描述")
    @Length(max = 128, message = "描述最多128个字符")
    private String remark;
}
